package com.sx.guavatest.controller;

import com.sx.guavatest.beans.JobBean;
import com.sx.guavatest.cache.LocalCache;
import com.sx.guavatest.service.JobDetailService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.*;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Map;

/**
 * @author shengx
 * @date 2020/8/7 22:29
 */
@RestController
@RequestMapping("/main")
public class MainController {

    @Autowired
    private RedisTemplate redisTemplate;

    @Autowired
    private LocalCache localCache;

    @Autowired
    private JobDetailService jobDetailService;

    private static String prefix = "job";
    @GetMapping("/mainHotList/{position}")
    public List<JobBean> getMainHotList(@PathVariable Integer position){
        return jobDetailService.getMainHotJob(position);
    }



    @PostMapping("/put")
    public String add(@RequestBody JobBean jobBean){
        jobDetailService.addMainHotJob(jobBean);
        return "success";
    }
}
